#tag Window
Begin Window winMain
   BackColor       =   13421772
   Backdrop        =   ""
   BalloonHelp     =   ""
   CloseButton     =   "False"
   Composite       =   "False"
   Frame           =   0
   FullScreen      =   "False"
   HasBackColor    =   "False"
   Height          =   600
   ImplicitInstance=   "True"
   LiveResize      =   "True"
   MacProcID       =   0
   MaxHeight       =   32000
   MaximizeButton  =   "True"
   MaxWidth        =   32000
   MenuBar         =   ""
   MenuBarVisible  =   "True"
   MinHeight       =   600
   MinimizeButton  =   "True"
   MinWidth        =   600
   Placement       =   0
   Resizeable      =   "True"
   Title           =   "Medievo"
   Visible         =   "True"
   Width           =   600
   Begin GroupBox gbxNext
      AutoDeactivate  =   "True"
      Bold            =   ""
      Caption         =   "Next Tile"
      ControlOrder    =   0
      Enabled         =   True
      Height          =   167
      HelpTag         =   ""
      Index           =   -2147483648
      InitialParent   =   ""
      Italic          =   ""
      Left            =   384
      LockBottom      =   "True"
      LockLeft        =   "False"
      LockRight       =   "True"
      LockTop         =   ""
      Scope           =   0
      TabPanelIndex   =   0
      TextFont        =   "System"
      TextSize        =   0
      Top             =   397
      Underline       =   ""
      Visible         =   "False"
      Width           =   198
      BehaviorIndex   =   0
   End
   Begin GameCanvas canBoard
      AcceptFocus     =   "True"
      AcceptTabs      =   ""
      AutoDeactivate  =   "True"
      Backdrop        =   ""
      ControlOrder    =   1
      Enabled         =   "True"
      EraseBackground =   "True"
      Height          =   550
      HelpTag         =   ""
      Index           =   -2147483648
      InitialParent   =   ""
      Left            =   20
      LockBottom      =   "True"
      LockLeft        =   "True"
      LockRight       =   "True"
      LockTop         =   "True"
      Scope           =   0
      TabPanelIndex   =   0
      Top             =   14
      UseFocusRing    =   "True"
      Visible         =   "True"
      Width           =   560
      BehaviorIndex   =   6
      Begin Canvas canNext
         AcceptFocus     =   ""
         AcceptTabs      =   ""
         AutoDeactivate  =   "True"
         Backdrop        =   ""
         ControlOrder    =   3
         Enabled         =   True
         EraseBackground =   "True"
         Height          =   100
         HelpTag         =   ""
         Index           =   -2147483648
         InitialParent   =   "canBoard"
         Left            =   408
         LockBottom      =   "True"
         LockLeft        =   ""
         LockRight       =   "True"
         LockTop         =   ""
         Scope           =   0
         TabPanelIndex   =   0
         Top             =   457
         UseFocusRing    =   "True"
         Visible         =   "False"
         Width           =   100
         BehaviorIndex   =   1
      End
      Begin BevelButton bvlCtrClockwise
         AcceptFocus     =   "False"
         AutoDeactivate  =   "True"
         Bevel           =   6
         Bold            =   "False"
         ButtonType      =   0
         Caption         =   ""
         CaptionAlign    =   3
         CaptionDelta    =   0
         CaptionPlacement=   1
         ControlOrder    =   4
         Enabled         =   "False"
         HasMenu         =   0
         Height          =   45
         HelpTag         =   ""
         Icon            =   716463140
         IconAlign       =   1
         IconDX          =   0
         IconDY          =   0
         Index           =   -2147483648
         InitialParent   =   "canBoard"
         Italic          =   "False"
         Left            =   527
         LockBottom      =   "True"
         LockLeft        =   ""
         LockRight       =   "True"
         LockTop         =   ""
         MenuValue       =   0
         Scope           =   0
         TabPanelIndex   =   0
         TextFont        =   "System"
         TextSize        =   0
         Top             =   512
         Underline       =   "False"
         Value           =   "False"
         Visible         =   "False"
         Width           =   45
         BehaviorIndex   =   3
      End
      Begin BevelButton bvlClockwise
         AcceptFocus     =   "False"
         AutoDeactivate  =   "True"
         Bevel           =   6
         Bold            =   "False"
         ButtonType      =   0
         Caption         =   ""
         CaptionAlign    =   3
         CaptionDelta    =   0
         CaptionPlacement=   1
         ControlOrder    =   5
         Enabled         =   "False"
         HasMenu         =   0
         Height          =   45
         HelpTag         =   ""
         Icon            =   655202057
         IconAlign       =   0
         IconDX          =   0
         IconDY          =   0
         Index           =   -2147483648
         InitialParent   =   "canBoard"
         Italic          =   "False"
         Left            =   527
         LockBottom      =   "True"
         LockLeft        =   ""
         LockRight       =   "True"
         LockTop         =   ""
         MenuValue       =   0
         Scope           =   0
         TabPanelIndex   =   0
         TextFont        =   "System"
         TextSize        =   0
         Top             =   457
         Underline       =   "False"
         Value           =   "False"
         Visible         =   "False"
         Width           =   45
         BehaviorIndex   =   2
      End
      Begin StaticText StaticText1
         AutoDeactivate  =   "True"
         Bold            =   ""
         ControlOrder    =   6
         DataField       =   ""
         DataSource      =   ""
         Enabled         =   True
         Height          =   20
         HelpTag         =   ""
         Index           =   -2147483648
         InitialParent   =   "canBoard"
         Italic          =   ""
         Left            =   394
         LockBottom      =   ""
         LockLeft        =   ""
         LockRight       =   "True"
         LockTop         =   "True"
         Multiline       =   ""
         Scope           =   0
         TabPanelIndex   =   0
         Text            =   "Current Player:"
         TextAlign       =   0
         TextColor       =   0
         TextFont        =   "System"
         TextSize        =   0
         Top             =   14
         Underline       =   ""
         Visible         =   "False"
         Width           =   95
         BehaviorIndex   =   8
      End
      Begin StaticText StaticText2
         AutoDeactivate  =   "True"
         Bold            =   ""
         ControlOrder    =   8
         DataField       =   ""
         DataSource      =   ""
         Enabled         =   True
         Height          =   20
         HelpTag         =   ""
         Index           =   -2147483648
         InitialParent   =   "canBoard"
         Italic          =   ""
         Left            =   398
         LockBottom      =   ""
         LockLeft        =   ""
         LockRight       =   ""
         LockTop         =   ""
         Multiline       =   ""
         Scope           =   0
         TabPanelIndex   =   0
         Text            =   "Tiles Left:"
         TextAlign       =   0
         TextColor       =   &h000000
         TextFont        =   "System"
         TextSize        =   0
         Top             =   425
         Underline       =   ""
         Visible         =   "False"
         Width           =   100
         BehaviorIndex   =   4
      End
      Begin StaticText txtTilesLeft
         AutoDeactivate  =   "True"
         Bold            =   ""
         ControlOrder    =   9
         DataField       =   ""
         DataSource      =   ""
         Enabled         =   True
         Height          =   20
         HelpTag         =   ""
         Index           =   -2147483648
         InitialParent   =   "canBoard"
         Italic          =   ""
         Left            =   467
         LockBottom      =   ""
         LockLeft        =   ""
         LockRight       =   ""
         LockTop         =   ""
         Multiline       =   ""
         Scope           =   0
         TabPanelIndex   =   0
         Text            =   ""
         TextAlign       =   0
         TextColor       =   &h000000
         TextFont        =   "System"
         TextSize        =   0
         Top             =   426
         Underline       =   ""
         Visible         =   "False"
         Width           =   100
         BehaviorIndex   =   5
      End
   End
   Begin StaticText txtState
      AutoDeactivate  =   "True"
      Bold            =   ""
      ControlOrder    =   2
      DataField       =   ""
      DataSource      =   ""
      Enabled         =   True
      Height          =   20
      HelpTag         =   ""
      Index           =   -2147483648
      InitialParent   =   ""
      Italic          =   ""
      Left            =   20
      LockBottom      =   "True"
      LockLeft        =   "True"
      LockRight       =   "True"
      LockTop         =   ""
      Multiline       =   ""
      Scope           =   0
      TabPanelIndex   =   0
      Text            =   ""
      TextAlign       =   0
      TextColor       =   0
      TextFont        =   "System"
      TextSize        =   0
      Top             =   576
      Underline       =   ""
      Visible         =   True
      Width           =   350
      BehaviorIndex   =   7
   End
   Begin StaticText txtCurrentPlayer
      AutoDeactivate  =   "True"
      Bold            =   ""
      ControlOrder    =   7
      DataField       =   ""
      DataSource      =   ""
      Enabled         =   True
      Height          =   20
      HelpTag         =   ""
      Index           =   -2147483648
      InitialParent   =   ""
      Italic          =   ""
      Left            =   487
      LockBottom      =   ""
      LockLeft        =   ""
      LockRight       =   "True"
      LockTop         =   "True"
      Multiline       =   ""
      Scope           =   0
      TabPanelIndex   =   0
      Text            =   ""
      TextAlign       =   0
      TextColor       =   0
      TextFont        =   "System"
      TextSize        =   0
      Top             =   14
      Underline       =   ""
      Visible         =   True
      Width           =   100
      BehaviorIndex   =   9
   End
End
#tag EndWindow

#tag WindowCode
	#tag Event
		Function KeyDown(Key As String) As Boolean
		  select case Asc(Key)
		  case 31 'up arrow
		    xyScroll.y = xyScroll.y - app.TILESIZE
		    canBoard.Scroll 0, -app.TILESIZE
		  case 29 'right arrow
		    xyScroll.x = xyScroll.x - app.TILESIZE
		    canBoard.Scroll -app.TILESIZE, 0
		  case 30 'down arrow
		    xyScroll.y = xyScroll.y + app.TILESIZE
		    canBoard.Scroll 0, app.TILESIZE
		  case 28 'left arrow
		    xyScroll.x = xyScroll.x + app.TILESIZE
		    canBoard.Scroll app.TILESIZE, 0
		  end select
		End Function
	#tag EndEvent

	#tag Event
		Sub Open()
		  me.Left = 0 + winAIRun.Width + 20
		  me.Top = winairun.Top
		  
		  xyScroll.x = 0
		  xyScroll.y = 0
		  
		  
		End Sub
	#tag EndEvent

	#tag Event
		Sub Maximize()
		  canBoard.Refresh
		End Sub
	#tag EndEvent


#tag MenuHandler
		Function itemNew() As Boolean Handles itemNew.Action
			msgbox "Not implemented  in this version"
			
			'facade.StartNewGame
			'txtTilesLeft.Text = "70"
			
			
			Return True
			
		End Function
#tag EndMenuHandler


	#tag Property, Flags = &h0
		xyScroll As Coordinates
	#tag EndProperty

	#tag Property, Flags = &h0
		facade As GameFacade
	#tag EndProperty

	#tag Property, Flags = &h0
		mode As Integer
	#tag EndProperty


#tag EndWindowCode

#tag Events canBoard
	#tag Event
		Sub Open()
		  
		  self.facade = app.GetGameFacade
		  self.Refresh
		  
		  
		End Sub
	#tag EndEvent
#tag EndEvents
#tag Events canNext
	#tag Event
		Sub Paint(g As Graphics)
		  if facade.GameExists then
		    if winmain.mode = 1 then
		      facade.GetCurrentTile.DrawNextTile
		    end if
		  end if
		End Sub
	#tag EndEvent
#tag EndEvents
#tag Events bvlCtrClockwise
	#tag Event
		Sub Action()
		  facade.RotateCounterclockwise
		End Sub
	#tag EndEvent
#tag EndEvents
#tag Events bvlClockwise
	#tag Event
		Sub Action()
		  facade.RotateClockwise
		End Sub
	#tag EndEvent
#tag EndEvents
